<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>库存管理 - WMS仓库管理系统</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/inventory.css">
</head>
<body>
    <div class="container">
        <!-- 登录界面 -->
        <section id="loginSection" class="login-section">
            <div class="login-container">
                <h2>WMS仓库管理系统登录</h2>
                <form id="loginForm">
                    <div class="form-group">
                        <label for="username">用户名:</label>
                        <input type="text" id="username" required>
                    </div>
                    <div class="form-group">
                        <label for="password">密码:</label>
                        <input type="password" id="password" required>
                    </div>
                    <button type="submit" class="btn-primary">登录</button>
                    <p>默认管理员账号: admin / 123456</p>
                </form>
            </div>
        </section>

        <!-- 主内容界面 -->
        <div id="mainContent" class="main-content">
            <header>
                <h1>库存管理</h1>
                <p>管理库存总览和明细信息</p>
                <div class="header-actions">
                    <a href="index.html" class="btn-secondary">返回首页</a>
                    <button id="logoutBtn" class="btn-secondary">退出登录</button>
                </div>
            </header>

            <main>
                <nav class="module-nav">
                    <ul>
                        <li><a href="#inventory-overview" class="active">库存总览</a></li>
                        <li><a href="#inventory-details">库存明细</a></li>
                    </ul>
                </nav>

                <!-- 库存总览 -->
                <section id="inventory-overview" class="module-section active">
                    <h2>库存总览</h2>
                    <!-- 查询条件区域 -->
                    <div class="filter-section">
                        <div class="filter-row">
                            <div class="form-group">
                                <label for="materialCode">物料编号:</label>
                                <input type="text" id="materialCode">
                            </div>
                            <div class="form-group">
                                <label for="materialName">物料名称:</label>
                                <input type="text" id="materialName">
                            </div>
                            <div class="form-group">
                                <label for="palletId">托盘号:</label>
                                <input type="text" id="palletId">
                            </div>
                            <div class="form-group">
                                <label for="documentId">单据号:</label>
                                <input type="text" id="documentId">
                            </div>
                        </div>
                        <div class="filter-row">
                            <div class="form-group">
                                <label for="aisle">巷道:</label>
                                <select id="aisle">
                                    <option value="">全部</option>
                                    <option value="A">A</option>
                                    <option value="B">B</option>
                                    <option value="C">C</option>
                                    <option value="D">D</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="row">排:</label>
                                <select id="row">
                                    <option value="">全部</option>
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="column">列:</label>
                                <select id="column">
                                    <option value="">全部</option>
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="level">层:</label>
                                <select id="level">
                                    <option value="">全部</option>
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                </select>
                            </div>
                        </div>
                        <div class="filter-actions">
                            <button id="searchBtn" class="btn-primary">查询</button>
                            <button id="resetBtn" class="btn-secondary">重置</button>
                            <button id="exportBtn" class="btn-primary">导出Excel</button>
                        </div>
                    </div>
                    
                    <div class="stats-grid">
                        <div class="stat-card">
                            <h4>总货物种类</h4>
                            <p id="totalGoodsTypes">0</p>
                        </div>
                        <div class="stat-card">
                            <h4>总库存数量</h4>
                            <p id="totalInventoryQuantity">0</p>
                        </div>
                        <div class="stat-card">
                            <h4>在库货位数</h4>
                            <p id="occupiedLocations">0</p>
                        </div>
                        <div class="stat-card">
                            <h4>空闲货位数</h4>
                            <p id="emptyLocations">0</p>
                        </div>
                    </div>
                    <div class="table-container">
                        <table id="inventoryOverviewTable">
                            <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>单据号</th>
                                    <th>物料编码</th>
                                    <th>物料名称</th>
                                    <th>物料总数量</th>
                                    <th>规格型号</th>
                                    <th>单位</th>
                                </tr>
                            </thead>
                            <tbody>
                                <!-- 库存总览数据将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>
                </section>

                <!-- 库存明细 -->
                <section id="inventory-details" class="module-section">
                    <h2>库存明细</h2>
                    <!-- 库存明细查询条件 -->
                    <div class="filter-section">
                        <div class="filter-row">
                            <div class="form-group">
                                <label for="detailMaterialCode">物料编码:</label>
                                <input type="text" id="detailMaterialCode">
                            </div>
                            <div class="form-group">
                                <label for="detailPalletId">托盘号:</label>
                                <input type="text" id="detailPalletId">
                            </div>
                            <div class="form-group">
                                <label for="detailDocumentId">单据号:</label>
                                <input type="text" id="detailDocumentId">
                            </div>
                            <div class="form-group">
                                <label for="detailWarehouseArea">库区:</label>
                                <select id="detailWarehouseArea">
                                    <option value="">全部</option>
                                    <option value="WH01">WH01</option>
                                </select>
                            </div>
                        </div>
                        <div class="filter-row">
                            <div class="form-group">
                                <label for="detailAisle">巷道:</label>
                                <select id="detailAisle">
                                    <option value="">全部</option>
                                    <option value="A">A</option>
                                    <option value="B">B</option>
                                    <option value="C">C</option>
                                    <option value="D">D</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="detailRow">排:</label>
                                <select id="detailRow">
                                    <option value="">全部</option>
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="detailColumn">列:</label>
                                <select id="detailColumn">
                                    <option value="">全部</option>
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="detailLevel">层:</label>
                                <select id="detailLevel">
                                    <option value="">全部</option>
                                    <option value="01">01</option>
                                    <option value="02">02</option>
                                    <option value="03">03</option>
                                    <option value="04">04</option>
                                </select>
                            </div>
                        </div>
                        <div class="filter-actions">
                            <button id="detailSearchBtn" class="btn-primary">查询</button>
                            <button id="detailResetBtn" class="btn-secondary">重置</button>
                            <button id="detailExportBtn" class="btn-primary">导出Excel</button>
                        </div>
                    </div>
                    <div class="table-container">
                        <table id="inventoryDetailsTable">
                            <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>货位号</th>
                                    <th>单据</th>
                                    <th>托盘号</th>
                                    <th>物料编码</th>
                                    <th>物料名称</th>
                                    <th>规格型号</th>
                                    <th>物料数量</th>
                                    <th>单位</th>
                                    <th>写入日期</th>
                                </tr>
                            </thead>
                            <tbody>
                                <!-- 库存明细数据将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>
                </section>
            </main>
        </div>

        <!-- 编辑货物模态框 -->
        <div id="editGoodsModal" class="modal">
            <div class="modal-content">
                <span class="close">&times;</span>
                <h2>编辑货物信息</h2>
                <form id="editGoodsForm">
                    <input type="hidden" id="editGoodsId">
                    <div class="form-group">
                        <label for="editGoodsName">物料描述:</label>
                        <input type="text" id="editGoodsName" required>
                    </div>
                    <div class="form-group">
                        <label for="editGoodsSku">物料编号:</label>
                        <input type="text" id="editGoodsSku" required>
                    </div>
                    <div class="form-group">
                        <label for="editGoodsUnit">物料单位:</label>
                        <input type="text" id="editGoodsUnit">
                    </div>
                    <div class="form-group">
                        <label for="editGoodsSpecification">规格:</label>
                        <input type="text" id="editGoodsSpecification">
                    </div>
                    <div class="form-group">
                        <label for="editGoodsQuantity">库存数量:</label>
                        <input type="number" id="editGoodsQuantity" step="0.001" min="0">
                    </div>
                    <div class="form-group">
                        <label for="editGoodsLocation">货位号:</label>
                        <input type="text" id="editGoodsLocation">
                    </div>
                    <div class="form-group">
                        <label for="editGoodsStatus">状态:</label>
                        <select id="editGoodsStatus">
                            <option value="inStock">在库</option>
                            <option value="outStock">出库</option>
                            <option value="reserved">预留</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="editGoodsBatch">批次号:</label>
                        <input type="text" id="editGoodsBatch">
                    </div>
                    <button type="submit" class="btn-primary">保存更改</button>
                </form>
            </div>
        </div>
    </div>

    <script src="js/inventory.js"></script>
</body>
</html>